﻿open System.Text.RegularExpressions
open System.IO

let rgStaticMember = new Regex("^\s*(\[\<[^\>]\>\]\s*)?static\s+member\s+((private|public|internal)\s+)?(\w+)")
let rgMember = new Regex("^\s*(\[\<[^\>]\>\]\s*)?(override|member)\s+[^\.]+\.\s*(\w+|(\([^\)]*\)))")
let rgAllExceptMember = new Regex("^\s*(\[\<[^\>]\>\]\s*)?(//#m|let!|let\s+mutable|let|type|module|namespace|and)\s+((private|public|internal)\s+)?(\w+|(\([^\)]*\))|(``.*?``))")

let testFile = @"C:\Users\FWARIS\Documents\Visual Studio 2010\Projects\FSharpJump\TestFSharpJump\Module1.fs"

//testFile |> File.ReadAllLines

let runRegex (r:Regex) = testFile |> File.ReadLines |> Seq.map r.Match |> Seq.filter (fun m->m.Success)
let gv (r:Match) = [for i in 0..r.Groups.Count-1 -> r.Groups.[i].Value]
runRegex rgStaticMember |> Seq.map gv |> Seq.toArray
runRegex rgMember |> Seq.map gv|> Seq.toArray
runRegex rgAllExceptMember |> Seq.map gv|> Seq.toArray